package cn.lyvust.demo02;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;
/**
 * Description:
 * date: 2021-6-1 16:14
 *
 * @author Guo_guo
 * @since JDK 1.8
 */
public class ChatServer {
    public static void main(String[] args) {
        Socket s = null;
        String msg = null;
        try {
            ServerSocket ss = new ServerSocket(7899);
            System.out.println("服务器已启动");
            while(true) {
                s = ss.accept();
                DataInputStream dis = new DataInputStream(s.getInputStream());
                System.out.println(dis.readUTF());
                dis.close();
                s.close();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
